package com.yuan.config;

import com.yuan.bean.Person;
import org.springframework.context.annotation.*;

@Configuration
//如果Java8之前的版本，则使用@ComponentScans注解来多次使用@ComponentScan注解
@ComponentScans(
        value = {
                @ComponentScan(value = "com.yuan", includeFilters = {
                        @ComponentScan.Filter(type = FilterType.CUSTOM, classes = {MyTypeFilter.class})
                }, useDefaultFilters = false) //自动扫描的包
        }
)
/*
 @ComponentScan.Filter过滤规则
 FilterType.ANNOTATION：按照注解(常用)
 FilterType.ASSIGNABLE_TYPE ：按照给定的类型(常用)
 FilterType.ASPECTJ：使用ASPECTJ表达式
 FilterType.CUSTOM ：使用自定义规则
 FilterType.REGEX ：使用正则表达式指定
 */
public class MyConfigTwo {
    @Bean(value = "person")
    public Person person() {
        return new Person("张三", 33);
    }
}
